package com.myFwk.service.serviceImpl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.myFwk.constant.Constants;
import com.myFwk.domain.SysMenu;
import com.myFwk.domain.SysRole;
import com.myFwk.mapper.SysMenuMapper;
import com.myFwk.mapper.SysRoleMapper;
import com.myFwk.service.SysMenuService;
import com.myFwk.service.SysRoleService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Title:
 * @Description:
 * @Author: guowl
 * @version： 1.0
 * @Date:2021/9/2
 * @Copyright: Copyright(c)2021 RedaFlight.com All Rights Reserved
 */
@Service
public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService {

    @Autowired
    private SysRoleMapper sysRoleMapper;


    @Override
    public boolean isSuperAdmin(Long userId) {
        String userRoleCode = sysRoleMapper.getUserRoleCode(userId);
        if (StringUtils.isNotEmpty(userRoleCode) && Constants.ROLE_CODE.equalsIgnoreCase(userRoleCode)) {
            return true;
        }
        return false;
    }
}
